<?php

/**
 * TMDAPI actions.
 *
 * @package    TMD
 * @subpackage TMDAPI
 * @author     Thaihosting
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class TMDAPIActions extends sfActions {

	public function executeListGeographicRegions(sfWebRequest $request) {
		
		/*
		$logger = sfContext::getInstance()->getLogger();//->info($message);
		$logger->info("Hello");
		*/
		$this->results = TMDService::listGeoRegions( array('language'=>'THAI') );

		$this->setTemplate('json');
	}
	
	
	
	public function executeListProvinces(sfWebRequest $request) {
	
		/*
		$logger = sfContext::getInstance()->getLogger();//->info($message);
		$logger->info("Hello");
		*/
		$this->results = TMDService::findProvinceByGeoRegion( array( 'regionId'=>$request->getParameter('regionId'), 'language'=>'THAI' ) );
	
		$this->setTemplate('json');
	}
	

	public function executeInputSevenDaysForecastByProvince(sfWebRequest $request) {
		$this->results = TMDService::findInputSevenDaysForecastByProvince( $request->getParameter( 'provinceId' ) );

		$this->setTemplate('json');
	}

	public function executeDay7Agromet(sfWebRequest $request) {
		//TODO Implement Function Body.
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );

		$this->setTemplate('json');
	}
	
	/**
	 * INPUT_4WKS_FORECAST
	 * @param sfWebRequest $request
	 */
	public function executeWeeks4Forecast(sfWebRequest $request) {
		//TODO Implement Function Body.
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeMonths3Forecast(sfWebRequest $request) {
		//TODO Implement Function Body.
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeDay7ForecastByGeoRegion(sfWebRequest $request) {
		//TODO Implement Function Body.
		// INPUT_3MONTHS_FORECAST
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeHour3(sfWebRequest $request) {
		//TODO Implement
		//INPUT_3HOUR
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeEarthquake(sfWebRequest $request) {
		//TODO Implement
		//EARTHQUAKE
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeDay7SummaryWeather(sfWebRequest $request) {
		//INPUT_7D_SUMMARY_WEATHER
		//TODO Implement
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeAgromet(sfWebRequest $request) {
		//INPUT_AGROMET
		//TODO Implement
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeDailyForecast(sfWebRequest $request) {
		//INPUT_DAILYFORECAST
		$this->results = TMDService::findInputDailyForecast( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeWeeklySummaryForecast(sfWebRequest $request) {
		//TODO Implement
		//INPUT_DAILYFORECAST
		$this->results = TMDService::findInputWeeklyForecast( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeMothlySummaryForecast(sfWebRequest $request) {
		//TODO Implement
		//INPUT_DAILYFORECAST
		$this->results = TMDService::findInputMonthlyForecast( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeSevenDaysForecast(sfWebRequest $request) {

		$this->results = TMDService::findInputSevenDaysForecast( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeThreeMonthForecast(sfWebRequest $request) {
		$this->results = TMDService::findInputThreeMonthForecast( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeElninoLanina(sfWebRequest $request) {
		//TODO Implement
		//INPUT_ELNINO_LANINA
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeFortnightAgromet(sfWebRequest $request) {
		//TODO Implement
		//INPUT_FORTNIGHT_AGROMET
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeMonthlyForecast(sfWebRequest $request) {
		//TODO Implement
		//INPUT_MONTHLY_FORECAST
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeSeasonsForecast(sfWebRequest $request) {
		//TODO Implement
		//INPUT_SEASONS_FORECAST
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeShipForecast(sfWebRequest $request) {
		//TODO Implement
		//INPUT_SHIP_FORECAST
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeStormLevels(sfWebRequest $request) {
		//STORM_LEVELS
		//TODO Implement
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeStormTrack(sfWebRequest $request) {
		//STORM_TRACK
		//TODO Implement
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeStormTrackPrediction(sfWebRequest $request) {
		//TODO Implement
		//STORM_TRACK_PREDICTION
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	
	public function executeStorms(sfWebRequest $request) {
		//TODO Implement
		//STORMS
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	
	public function executeTemperatureType(sfWebRequest $request) {
		//TODO Implement
		////TEMPERATURE_TYPE
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeWaveType(sfWebRequest $request) {
		//TODO Implement
		// WAVE_TYPE
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeWeatherType(sfWebRequest $request) {
		//TODO Implement
		// WEATHER_TYPE
		$this->results = TMDService::findInput7dForecastByGeRegion( $request->getParameter( 'regionId' ) );
	
		$this->setTemplate('json');
	}
	
	public function executeTmd( sfWebRequest $request ) {
		sfConfig::set('sf_web_debug', false);
		
		$this->sf_params = $request;
	}
	
}
